package nil.ed.livechat.timeshift.sync.guice;

import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import nil.ed.livechat.timeshift.sync.TsScheduledUpdateTask;
import nil.ed.livechat.timeshift.sync.common.ConfigContext;
import nil.ed.livechat.timeshift.sync.ext.PublishEventSubscriber;
import nil.ed.livechat.timeshift.sync.ext.RedisSyncService;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.JedisPool;

import java.util.concurrent.DelayQueue;

/**
 * @author delin10
 * @since 2020/6/26
 **/
public class BaseModule extends AbstractModule {

    @Provides
    @Singleton
    public DelayQueue<TsScheduledUpdateTask.UpdateMetaData> getQueue() {
        return new DelayQueue<>();
    }

    @Provides
    @Singleton
    public ConfigContext getConfigContext() {
        return new ConfigContext();
    }

    @Provides
    @Singleton
    public JedisPool getPool() {
        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        return new JedisPool(config,"180.76.247.245", 8080, 10000,"123456");
    }

}
